package com.zbzbzzz.controller;

import com.zbzbzzz.pojo.good;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @Author ：zbzbzzz
 * @Date ：Created in 10:57 2021/2/25
 * @Description：_____
 * @Modified By：
 * @Version: X.X
 */
@Controller
@RequestMapping("/test")
public class HelloController {

	@GetMapping("/json")
	@ResponseBody
	public good returnJson(){
		good g = new good();
		g.setPrice(99);
		g.setName("时间的话");
		return g;
	}

	@RequestMapping(value = "/hello/{id}", method = RequestMethod.GET)
	public String helloWorld(@PathVariable Integer id) {
		good g = new good();
		g.setName("123");
		modifyName(g);
		System.out.println(g.getName());
		System.out.println("get" + id);

		return "index";
	}



	public void modifyName(good g){
		g = new good();
		g.setName("321");
	}
}
